/**
 * Project Name:OrderRouter.java
 * File Name:OrderRouter.java
 * Date:2019/3/29 17:10
 * Copyright (c) 2019, zhang.xiangyu@foxmail.com All Rights Reserved.
 */
package com.meatball.order.router;

import com.meatball.order.handler.OrderHandler;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.web.reactive.function.server.RouterFunction;
import org.springframework.web.reactive.function.server.ServerResponse;

import static org.springframework.web.reactive.function.server.RouterFunctions.route;

/**
 * @Title: OrderRouter.java
 * @Description: todo(订单接口层)
 * @Author: 張翔宇
 * @Date: 2019/3/29 17:10
 * @Version: V1.0
 */
@Configuration
public class OrderRouter {
    private final OrderHandler handler;

    public OrderRouter(OrderHandler handler) {
        this.handler = handler;
    }

    @Bean
    public RouterFunction<ServerResponse> order () {
        return route()
                .path("/report/order", builder -> builder
                        // 查询流水集合
                        .GET("/serial/page", handler::serialPage)
                        .GET("/serial/list", handler::seriaList)
                ).build();
    }
}
